#pragma once

#include "SceneMeshContext.hxx"

namespace Eifersucht
{
	// Prototypes

	class SkeletonContext; TinyTypeDecl( SkeletonContext );
	class SceneChild; TinyTypeDecl( SceneChild );
	class Scene; TinyTypeDecl( Scene );

	// Implementation

	class SkeletonContext : public SceneChildContext
	{
		friend MeshContext;
		friend SceneChild;
		friend Scene;

	public: 

		typedef std::map<String8, MeshContext::BonePtr> MeshSkeletonMap;
		TinyTypeDecl(MeshSkeletonMap);

	public: 

		SkeletonContext();
		~SkeletonContext();

	public:

		REIGN_HINTINLINING MeshSkeletonMapConstRef GetConnectionsByReference() const { return m_vnData; }
		REIGN_HINTINLINING MeshSkeletonMapRef EditConnectionsByReference() { return m_vnData; }
		REIGN_HINTINLINING MeshSkeletonMapConstPtr GetConnections() const { return &m_vnData; }
		REIGN_HINTINLINING MeshSkeletonMapPtr EditConnections() { return &m_vnData; }

		REIGN_HINTINLINING void SetFor( _In_z_ String8 szMesh, _In_ MeshContext::BonePtr pBone )
		{
			if ( m_vnData.count(szMesh) ) AssertWithMessage(false, "Already assigned.");
			m_vnData[szMesh] = pBone;
		}

		REIGN_HINTINLINING MeshContext::BonePtr GetFor( _In_z_ String8 szMesh )
		{
			return m_vnData[szMesh];
		}

	protected:

		MeshSkeletonMap m_vnData;

	};
};